package com.ruoyi.project.system.uflo.handler;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.bstek.uflo.env.Context;
import com.bstek.uflo.model.ProcessInstance;
import com.bstek.uflo.process.handler.NodeEventHandler;
import com.bstek.uflo.process.node.Node;
import com.ruoyi.project.asset.assets.domain.Assets;
import com.ruoyi.project.asset.assets.service.IAssetsService;
import com.ruoyi.project.system.uflo.model.constant.UfloConstant;

/**
 * 资产结束节点
 * @author xianz
 *
 */
@Component
public class AssetLastNodeEventHandler implements NodeEventHandler{

	
	@Autowired
	IAssetsService assetsService;
	
	@Override
	public void enter(Node node, ProcessInstance processInstance, Context context) {
		System.out.println("jiehsu");
	}

	@Override
	public void leave(Node node, ProcessInstance processInstance, Context context) {
		Assets assets = assetsService.getById(processInstance.getBusinessId());
		//审核完成
		assets.setFlowState(UfloConstant.FLOW_STATE_3);
		assetsService.updateById(assets);
	}

}
